package com.example.app2024.CustomView.Atoz;

import android.annotation.SuppressLint;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.app2024.R;

public class AtoZActivity extends AppCompatActivity implements LetterSideBar.LetterTouchListener
{

      private TextView mLetterTv;
      private LetterSideBar mLetterSideBar;

      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
            super.onCreate(savedInstanceState);
            EdgeToEdge.enable(this);
            setContentView(R.layout.activity_ato_zactivity);

            mLetterTv = (TextView) findViewById(R.id.letter_tv);
            mLetterSideBar = (LetterSideBar) findViewById(R.id.letter_side_bar);
            mLetterSideBar.setOnLetterTouchListener(this);

      }

      @Override
      public void touch(CharSequence letter, boolean isTouch)
      {
            if (isTouch)
            {
                  mLetterTv.setVisibility(View.VISIBLE);
                  mLetterTv.setText(letter);
            } else
            {
                  mLetterTv.setVisibility(View.GONE);
            }
      }

      public void doaytask(View view)
      {

         AsyncTask task =   new AsyncTask<>()
            {

                  @Override
                  protected void onPostExecute(Object o)
                  {
                        super.onPostExecute(o);
                        Log.i("TAG", "onPreExecute: 三秒结束了" + Thread.currentThread().getName());
                  }

                  @Override
                  protected void onPreExecute()
                  {
                        Log.i("TAG", "onPreExecute: 三秒结束了" + Thread.currentThread().getName());
                  }

                  @Override
                  protected Object doInBackground(Object... objects)
                  {
                        Log.i("TAG", "onPreExecute: 三秒结束了" + Thread.currentThread().getName());
                        return null;
                  }
            };

         task.execute();
      }
}